package com.yuzhitong.shapi.activity;

import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.yuzhitong.shapi.R;
import com.yuzhitong.shapi.base.BaseLayoutActivity;
import com.yuzhitong.shapi.base.Contents;
import com.yuzhitong.shapi.util.LoggerUtil;

/**
 * Created by Brsya
 * CreateDate: 2022/4/2  8:29
 * Description:
 * 用户协议页面
 */
public class AgreementWebActivity extends BaseLayoutActivity {

    private RelativeLayout llPageTitleBox;
    private WebView wvAgreement;
    private View vStatus;
    private LinearLayout llTitleBackBox;
    private TextView tvPageTitle;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_agreement);

        setDarkStatus();
        initView();
    }

    private void initView() {
        String url = getIntent().getStringExtra(Contents.INTENT_H5_AGREEMENT);
        if (url == null) {
            LoggerUtil.e("Url为空");
            finish();
            return;
        }
        llPageTitleBox = findViewById(R.id.ll_page_title_box);
        wvAgreement = (WebView) findViewById(R.id.wv_agreement);
        llTitleBackBox = findViewById(R.id.ll_title_back_box);
        tvPageTitle = findViewById(R.id.tv_page_title);


        llPageTitleBox.setPadding(
                llPageTitleBox.getPaddingLeft(),
                llPageTitleBox.getPaddingTop() + getStatusBarHeight(),
                llPageTitleBox.getPaddingRight(),
                llPageTitleBox.getPaddingBottom()
        );

        tvPageTitle.setText(getIntent().getStringExtra(Contents.INTENT_TITLE_AGREEMENT));

        wvAgreement.loadUrl(getIntent().getStringExtra(Contents.INTENT_H5_AGREEMENT));
        llTitleBackBox.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }
}
